package com.google.code.netbuilder.services.equipment;

import java.io.Serializable;
import java.util.List;

import javax.ejb.EJB;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;
import com.google.code.netbuilder.dal.entities.Equipment;
import com.google.code.netbuilder.dal.providers.IEquipmentProvider;
import com.google.code.netbuilder.logging.NetBuilderLogger;
import com.google.code.netbuilder.logging.NetBuilderLoggerFactory;
import com.google.code.netbuilder.dal.providers.IPortProvider;
import javax.faces.bean.ViewScoped;

/**
 * View all equipments
 *
 * @author Sergey Kozlov
 *
 */
@ManagedBean(name = "equipmentService")
@ViewScoped
public class EquipmentViewService implements Serializable {

    private static final NetBuilderLogger LOGGER = NetBuilderLoggerFactory.getNetBuilderLogger(EquipmentViewService.class);
    private static final long serialVersionUID = -7201197613461007018L;
    private Equipment selectedEquipment;
    List<Equipment> equipments;
    @EJB(name = "portProviderJPA")
    private IPortProvider pp;
    @EJB(name = "equipmentProviderJPA")
    private IEquipmentProvider ep;

    public EquipmentViewService() {
        LOGGER.entry();
        LOGGER.exit();
    }

    public List<Equipment> getEquipments() {
        return ep.findAll();
    }

    public void setEquipments(List<Equipment> equipments) {
        this.equipments = equipments;
    }

    public Equipment getSelectedEquipment() {
        return selectedEquipment;
    }

    public void setSelectedEquipment(Equipment selectedEquipment) {
        this.selectedEquipment = selectedEquipment;
    }
}
